#include <list>
#include <iostream>
using namespace std;



int main() {
    int numberOfCouples;

    while(cin>>numberOfCouples && numberOfCouples) {
        int n = 2*numberOfCouples;
		list<int> people;

		// assign an array to set the positions of the couples ..
		int* constructionArr = new int[n];

		// set the positions of the couples ..
		int posHusband, posWife;
		for(int i=0;i<numberOfCouples;++i) {
			cin >> posHusband >> posWife;
			constructionArr[posHusband-1] = i;
			constructionArr[posWife-1] = i;
		}

		// initialize the people list with constructionArr ..
		people.clear();
		for(int i=0;i<n;++i) {
			people.push_back(constructionArr[i]);
		}
		
		// release the resources of constructionArr ..
		delete constructionArr;

		// loop reduce the pairs ..
		bool isFinished = false;
		list<int>::iterator it = people.begin();
		while(isFinished==false && people.size()>0) {
			// check if iterator is the end of the list of people ..
			if(it!=people.end()) { // not the end of the list of people ..
				// if catch pair ..
				list<int>::iterator it2 = it;
				advance(it2,1);
				if((*it) == (*it2)) {
					// check if is the head of list ..
					if (it == people.begin()) {
						// pop the front two people ..
						people.pop_front();
						people.pop_front();
					
						// check if all reduced ..
						if(people.size()==0) {
							continue;
						}

						// reset the iterator to the front ..
						it = people.begin();
					}
					else {
						// reset the iterator to its previous position ..
						advance(it, -1);

						// erase the pair ..
						list<int>::iterator it2;
						it2 = it;
					    ++it2;
						people.erase(it2);
						it2 = it;
						++it2;
						people.erase(it2);
					}

					// continue ..
					continue;
				}

				// not catch pair, go to the next position ..
				++it;
			}
			else { // the end of the list of people
				// check if catch pair ..
				if(people.front() == people.back()) { // catch pair ..
					// pop the pair ..
					people.pop_front();
					people.pop_back();

					// check if all reduced ..
					if(people.size() == 0) {
						continue;
					}

					// reset the iterator to the end of the list of people ..
					it = people.end();
				}
				else { // not catch pair ..
					// fail to reduce, finish reducing process ..
					isFinished = true;
					continue;
				}
			}
		}

		// check the result ..
		if(people.size() == 0) { // all reduced ..
			cout << "Yes" << endl;
		}
		else { // failed to reduce ..
			cout << "No" << endl;
		}
    }
    
    return 0;
}
